package com.tensquare.qa.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tensquare.qa.pojo.Problem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description
 * @Date 2021/3/19 19:58
 */
@Mapper
@Repository
public interface ProblemMapper extends BaseMapper<Problem> {

    @Select("select * from tb_problem where id in (select problemid from tb_pl where labelid = #{labelid}) order by replytime desc")
    List<Problem> newlist(String labelid, Page<Problem> pages);

    @Select("select * from tb_problem where id in (select problemid from tb_pl where labelid = #{labelid} ) order by reply desc")
    List<Problem> hotlist(String labelid, Page<Problem> pages);

    @Select("select * from tb_problem where id in (select problemid from tb_pl where labelid = #{labelid} ) and reply= 0 order by createtime desc")
    List<Problem> waitlist(String labelid, Page<Problem> pages);

}
